﻿using UnityEngine;

public class PlayerSwordAimState: PlayerStateBase            
{
    
    private GameObject[] dots;
    
    public PlayerSwordAimState(ControllerBase controller, StateMachineBase stateMachine, 
        string stateName, string animatorParameter) : base(controller, stateMachine, stateName, animatorParameter)
    {
    }

    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
        //设置为busy防止快速触发move状态
        controller.StartBusy(0.2f);
    }

    public override void Update()
    {
        base.Update();
        SelfController.SetVelocity(Vector2.zero);
        if (Input.GetKeyUp(KeyCode.Q))
        {
            stateMachine.ChangeState(Setting.idle);
            return;
        }
        Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        if (mousePos.x>SelfController.transform.position.x&&!SelfController.isFacingRight)
        {
            SelfController.Flip();
        }else if (mousePos.x<SelfController.transform.position.x&&SelfController.isFacingRight)
        {
            SelfController.Flip();
        }
    }
}